[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
getmaxx() Get the Current x Resolution
#include <graphics.h>
int far getmaxx(void);
getmaxx() returns the maximum x screen coordinate for the current
graphics mode. This function is very useful for positioning text and
graphics on the screen.
Returns: The maximum x screen coordinate.
-------------------------------- Example ---------------------------------
The following statements center the string on the screen and print
it.
#include <graphics.h>
#include <conio.h>
int gdriver = DETECT;
int gmode;
main()
{
int maxx, maxy;
int xcenter, ycenter, adjx;
int len;
char *tst = "This string is centered.";
initgraph(&gdriver,&gmode,"");
maxx = getmaxx();
maxy = getmaxy();
xcenter = maxx/2;
ycenter = maxy/2;
len = strlen(tst)*8;
adjx = xcenter - len/2;
outtextxy(adjx,ycenter,tst);
getch();
closegraph();
}
See Also:
getmaxy()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson